import React from 'react';
import ReactDOM from 'react-dom';
import App, { version } from './App';
import { store, connect } from './store';
import { history } from './router';

console.log('load index');

//每次刷新后强制回首页
// history.replace('/');

connect();
ReactDOM.render(<App store={store} />, document.getElementById('root'));

if (module.hot) {
	module.hot.decline('./store.js');
	var registerHotUpdate;
	registerHotUpdate = function() {
		module.hot.accept(['./App', './router'], () => {
			console.log('***** accept App hot update 1*******', version);
			global.lastHotUpdateTime = Date.now();
			let App = require('./App').default;
			ReactDOM.render(<App store={store} />, document.getElementById('root'));
			// console.log('***** accept App hot update 2*******');
		});
	};
	registerHotUpdate();
}
